<?php
/**
 * index Action Controller
 * 
 * @author RiderSx <alexridersx@gmail.com>
 */
class discussions_Controller {
	public $__default = 'HTML';
	
	public function proceedHTML () {
		xine::$view->showHeader();
		
		$discussions = xine::$model->getAllDiscussions();
		
		if($discussions) {
			foreach($discussions as $discuss) {
				$discussion = array(
					'discussion_id' => $discuss['id'],
					'discussion_name' => $discuss['name'],
					'discussion_state' => $discuss['state'],
					'discussion_replys_count' => $discuss['replys_count'],
					'discussion_last_reply_by' => $discuss['last_reply_by'],
					'discussion_last_reply_time' => xine::$view->getDate($discuss['last_reply_time'])
				);
				
				xine::$view->tpl->single('discussion_single', $discussion);
			}
		} else {
			xine::$view->noTalks();
		}
		
		xine::$view->showFooter();
	}
	
	public function proceedAJAX () {
		
	}
}